package engine.newUi 
{
	import engine.control.TurnPapersViewGroup;
	import engine.data.ModelLocator;
	import engine.data.Record;
	import engine.data.ResPath;
	import engine.data.View;
	import engine.data.ViewObject;
	import engine.display.AttAckMsgCacheLogic;
	import engine.display.newAttack.AttackLogic;
	import engine.flag.ResourcesPath;
	import engine.net.messages.CustomToServerFlag;
	import engine.net.mgr.SystemSender;
	import engine.ui.AlertUI;
	
	import flash.display.DisplayObjectContainer;
	import flash.display.MovieClip;
	import flash.events.MouseEvent;
	import flash.text.TextField;
	
	import mx.resources.ResourceBundle;
	import mx.resources.ResourceManager;
	
	import newx.StageInfo;
	import newx.com.ResManager;
	import newx.com.config.StaticIni;
	import newx.com.control.NxClip;
	import newx.com.control.button.NxButton;
	import newx.com.control.window.NxWindowEvent;

	/**
	 * ...
	 * @author WangHaiBo  www.woniu.com
	 */
	public class DuplicatesLogic 
	{
		private static var _self		:DuplicatesLogic
		private var _myDisplay			:DuplicatesUI
		//副本数组
		private var _itemArray			:Array;
		//索引
		private var _index				:int	=	0;
		private var _turnPagersViewGroup:TurnPapersViewGroup;
		private var _model				:ModelLocator
		private var _isPass:Boolean;
		private var intoSceneID:int;
		private var _oldMc:MovieClip		=	null;
		//当前可进的副本索引号
		private var _isCanInitFbIndex:int	=	0;
		private var _FBSceneID:String		=	"";
		private var _FBSceneType:String	=	"";
		
		public static var PK_FB:String	=	"PK_FB";
		public static var COLL_FB:String	=	"COLL_FB";
		
		private var _isOpen			:Boolean = true;
		
		/**VIP卡ID***/
		private const VIPCONFIGID:int =39021011; 
		public function DuplicatesLogic() 
		{
			_myDisplay	=	DuplicatesUI.getInstance();
			Init();
		}
		public static function getInstance():DuplicatesLogic
		{
			if (_self == null) 
			{
				_self =	new DuplicatesLogic();
			}
			return _self;
		}

		/**
		 * 添加事件
		 */
		public function addListener():void
		{
			_turnPagersViewGroup.addListener();
			_myDisplay.windowBG.addEventListener(NxWindowEvent.WINDOW_CLOSE,windeowClose)
			_myDisplay.itemGroup.addItemsEvent(MouseEvent.CLICK,itemClickHandle);
		}
		/**
		 * 删除事件
		 */
		public function removeListener():void
		{
			_myDisplay.windowBG.removeEventListener(NxWindowEvent.WINDOW_CLOSE,windeowClose)
			_turnPagersViewGroup.removeListener();
			_myDisplay.itemGroup.removeItemsEvent(MouseEvent.CLICK,itemClickHandle);
			_FBSceneID	=	"";
		}
		/**
		 * 显示对应的副本信息
		 * @param	val
		 */
		public function showInfo(val:String):void
		{
			if(_myDisplay.visible)return;
			var lastCompleteFbIndex : int;
			var oldItem : Object;
			_turnPagersViewGroup.clear();
			_itemArray	=	[];
			var fbItemObj:Object	=	StaticIni.getIniObj(val);
			if (fbItemObj != null)
			{
				_myDisplay.namePic.source	=	ResPath.PNG +fbItemObj["actName"] + ".png";
				var count:int	=	fbItemObj["countChapter"];
				for (var i:int = 1; i <= count; i++) 
				{
					var item:Object	=	StaticIni.getIniObj(val + "_" + i)
					if (item != null)
					{
						if (i > 1) 
						{
							item["preFBID"]	= 	StaticIni.getIniObj(val + "_" + (i -1))["chapterEnterScene"];
						}
						else
						{
							item["preFBID"]	= 	0;
						}
						//如果后面的副本不可打，只要在当前页都 显示出了，过了这页的就算了
						if(getType(item["preFBID"]) && getTaskComplete(item["TaskCompleteID"]))
						{//打完的
							_itemArray.push(item);
							
							lastCompleteFbIndex = i;
							
							oldItem = item;
						}
						else
						{//不可以打的
							if( oldItem != null && getType( oldItem[ "chapterEnterScene" ] ) )
							{//当上一个是完成状态，下一个正好是没开启
								if( TaskTrackingUI.getInstance().hasImportTask() )
								{//有主线任务
									SitAlerLogic.getIntatic().setUIinfo(StaticIni.getSwfLangStr( "UIString_1000330" ),[], click,_myDisplay.preBtn,false);
									function click():void
									{
										TaskTrackingUI.getInstance().autoAcceptByFb();
									}
								}
							}
							_itemArray.push(item);
							if(i % _myDisplay.itemGroup.col == 0)
							{
								break;
							}
							oldItem = null;
						}
						//_turnPagersViewGroup.addItem(item);
					}
				}

			}
			if( !_myDisplay.created )
			{
				_myDisplay.showOrHide();
			}
			_turnPagersViewGroup.dataProvider	=	_itemArray;
			checkIntoTaskFbID();
			
//			if( lastCompleteFbIndex != 0 )
//			{
//				if( lastCompleteFbIndex > 5 )lastCompleteFbIndex = lastCompleteFbIndex % 5;
//				var itemMC:MovieClip	=	_myDisplay.itemGroup.getItemByIndex(lastCompleteFbIndex -1 );
//				if(itemMC == null)return;
//				itemMC.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
//			}
		}
		/**
		 * 指定选中的副本场景号
		 * @param val  显示类型
		 * @param type 类型
		 */		
		public function FBSceneID(val:String,type:String):void
		{
			_FBSceneID		=	val;
			_FBSceneType	=	type;
		}
		/**
		 * 删除对象
		 * @param	mc
		 */
		public function removeItem(mc:MovieClip):void 
		{
			mc.visible				=	false;
			var pic:NxClip			=	mc["image"]	as NxClip;
			var pic_2:NxClip		=	mc["image_2"]	as NxClip; 
			var title:TextField		=	mc.getChildByName("title") as TextField;
			var enterBtn:NxButton	=	mc.getChildByName("enterBtn") as NxButton
			var wipeBtn:NxButton	=	mc.getChildByName("wipeBtn") as NxButton
			enterBtn.visible		=	wipeBtn.visible	=	false;
			pic.source				=	"";
			pic_2.source			=	"";
			title.text				=	"";
			pic.removeEventListener(MouseEvent.CLICK, picClickHandle)
			enterBtn.removeEventListener(MouseEvent.CLICK, btnClickHandle);
			wipeBtn.removeEventListener(MouseEvent.CLICK, btnClickHandle);
//			for (var i:int = 0; i < 5; i++) 
//			{
//				var star:MovieClip	=	mc.getChildByName("s" + i) as MovieClip;
//				star.gotoAndStop(1);
//				star.visible	=	false
//			}
			mc["data"]				=	null;
			
		}
		/**
		 * 显示对象
		 * @param	mc
		 * @param	data
		 */
		public function showItem(mc:MovieClip,data:Object):void
		{
			mc.visible				=	true;
			var pic:NxClip			=	mc["image"] as NxClip;
			var pic_2:NxClip		= 	mc["image_2"] as NxClip; 
			
			pic_2.source="" ;
			pic_2.clear();
			pic_2.visible=false;
			mc["bgblack"].visible =false; 
			
			if (getType(data["preFBID"]) && getTaskComplete(data["TaskCompleteID"])) 
			{
//				var powerNum:int		=	getGread(data["chapterEnterScene"])
				var powerNum:int		=	data["chapterGrade"];
				var title:TextField		=	mc.getChildByName("title") as TextField;
				pic.source				=	ResPath.JPG +data["chapterMiniPic"] + ".jpg";
				title.text				=	StaticIni.getSwfLangStr(data["chapterName"]);
				
				
				if(data["fbBossHeadPic"]!=null)
				{
					ResourcesPath.getHalfPic(int(data["fbBossHeadPic"]),pic_2);
					pic_2.visible=true;
					mc["bgblack"].visible =true ; 
				}
				for (var i:int = 0; i < 5; i++) 
				{
					var star:MovieClip	=	mc.getChildByName("s" + i) as MovieClip;
					if (i < powerNum)
					{
						star.visible=true;
					}
					else
					{
						star.visible=false ;
					}
//					star.visible	=	true;
				}
				mc["data"]				=	data;
			}
			else
			{
				
				for (var j:int = 0; j < 5; j++) 
				{
					var star1:MovieClip	=	mc.getChildByName("s" + j) as MovieClip;
					star1.visible=false ;
				}
				pic.source				=	ResPath.JPG + "FBListSceneS_0000.jpg";
			}
		}
		/**
		 * 进入副本的场景号
		 */
		public function againIntoFb():void
		{
			AttackLogic.getInstance().fighting = false;
			
			AttAckMsgCacheLogic.getInstance().clear();
			
			SystemSender.getInstance().CustomMsg(CustomToServerFlag.CLIENT_CUSTOMMSG_FB_ENTER, intoSceneID);
		}
		/**
		 * 翻页后的操作
		 */
		public function afterShowItem():void
		{
			var selectIndex:int		=	_turnPagersViewGroup.chooseIndex;
			if(selectIndex != -1)
			{
				var itemMC:MovieClip	=	_myDisplay.itemGroup.getItemByIndex(selectIndex);
				itemMC.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
			}
			else
			{
				if(_oldMc != null)
				{
					_oldMc.gotoAndStop(1);
					_oldMc.enterBtn.visible		=	false;
					_oldMc.wipeBtn.visible		=	false;
				}
				_myDisplay.intoEffect.stop();
				_myDisplay.intoEffect.visible	=	false;
				_myDisplay.collEffect.stop();
				_myDisplay.collEffect.visible	=	false;
			}
		}
		/**
		 * 初始化
		 */
		private function addPicItem():void
		{
			for (var i:int = 0; i < _myDisplay.itemGroup.row * _myDisplay.itemGroup.col; i++) 
			{
				
				var item:MovieClip	=	_myDisplay.itemGroup.getItemByIndex(i);
				var title:TextField	=	item.getChildByName("title") as TextField;
				var pic:MovieClip	=	item.getChildByName("pic") as MovieClip;
				var pic_2:MovieClip	=	item.getChildByName("pic2") as MovieClip;
				
				item.gotoAndStop(1);
				while (pic.numChildren > 1) 
				{
					pic.removeChildAt(1);
				}
				//开启**************************
				for (var j:int = 0; j < 5; j++) 
				{
					var star:MovieClip	=	item.getChildByName("s" + j) as MovieClip;
					star.gotoAndStop(1);
//					item.removeChild(star);
					star.visible	=	false	
				}
				title.text				=	"";
				//
				var image:NxClip		=	new NxClip();
				image.isCache			=	true;
				pic.addChild(image);
				//YCG 新加的章节人物图片
				var  image_2:NxClip    = new NxClip();
				image_2.isCache			=	true;
				pic_2.addChild(image_2);
				
				item["bgblack"].visible =false ; 
				
				item["image_2"]			=	image_2;
				item["image"]			=	image;
				
				var enterBtn:NxButton	=	new NxButton();
				enterBtn.skin			=	"Button_20";
				enterBtn.label			=	StaticIni.getSwfLangStr("CastleArea_ItemOneBtnThree_1");
				enterBtn.height			=	30;
				enterBtn.width			=	65
				item["enterBtn"]		=	enterBtn;
				var wipeBtn:NxButton	=	new NxButton();
				wipeBtn.skin			=	"Button_20";
				wipeBtn.label			=	StaticIni.getSwfLangStr("AFKFB_WindowsTitle");
				wipeBtn.height			=	30;
				wipeBtn.width			=	65;
				item["wipeBtn"]		=	wipeBtn;
				enterBtn.x	=	21;
				wipeBtn.x	=	86;
				
				enterBtn.y	=	wipeBtn.y	=	117;	
				enterBtn.visible	=	wipeBtn.visible	=	false;
				
				wipeBtn.name	=	"wipeBtn";
				enterBtn.name	=	"enterBtn";
				item["index"]	=	i;
				item.addChild(enterBtn);
				item.addChild(wipeBtn);
			}
		}
		private function Init():void
		{
			_myDisplay.collEffect.visible		=	false;
			_myDisplay.intoEffect.visible		=	false;
			_myDisplay.intoEffect.gotoAndStop(1);
			_myDisplay.collEffect.gotoAndStop(1);
			_myDisplay.namePic.mouseChildren	=	_myDisplay.namePic.mouseEnabled	=	false;
			_model		=	ModelLocator.getInstance();
			_itemArray	=	[]
			addPicItem();
			_turnPagersViewGroup	=	new TurnPapersViewGroup(_myDisplay.itemGroup, _myDisplay.preBtn, _myDisplay.nxtBtn,
				showItem, removeItem, afterShowItem)
//			_myDisplay.greenLine.source = ResPath.PNG+"FBline.png";

				
		}
		/**
		 * 显示章节信息
		 * @param	val
		 */
		private function showItemInfo(val:Object):void
		{
			if (val != null) 
			{
				_myDisplay.chapterPic.source	=	ResPath.PNG +val["chapterDes"] + ".png";
				_myDisplay.backPic.source	=	ResPath.JPG +val["chapterBackPic"] + ".jpg";
				_myDisplay.equipInfo.htmlText=	StaticIni.getSwfLangStr(val["chapterDropDes"]);
			}
			else
			{
				_myDisplay.chapterPic.source	=	"";
				_myDisplay.backPic.source		=	"";
				_myDisplay.equipInfo.htmlText	=	"";
			}
		}
		/**
		 * 检查是否需要打开指定的副本子项;
		 * 如没有指定，打开最后一个可进入的
		 */
		private function checkIntoTaskFbID():void
		{
			var canIndex:int	=	0;
			var needIndex:int	=	-1;
			var item:Object	=	{};
			for(var i:int = 0; i < _itemArray.length; i++)
			{
				item	=	_itemArray[i] as Object
				if(getType(item["preFBID"]))
				{
					canIndex = i;
				}
				if(_FBSceneID != "")
				{
					if(item["chapterEnterScene"] == _FBSceneID)
					{
						needIndex = i;
					}
				}
			}
			if(_FBSceneID != "")
			{
				if(needIndex == -1)
				{
					_isCanInitFbIndex	=	canIndex;
				}
				else
				{
					_isCanInitFbIndex	=	needIndex > canIndex	?	canIndex : needIndex;
				}
			}
			else
			{
				_isCanInitFbIndex	=	canIndex;
			}
			_turnPagersViewGroup.chooseDataItem	=	_isCanInitFbIndex;
		}
		/**
		 * 关闭窗口
		 * @param	e
		 */
		private function windeowClose(e:NxWindowEvent):void 
		{
			_myDisplay.hide()
		}
		/**
		 * 点击内容项
		 * @param e
		 * 
		 */		
		private function itemClickHandle(e:MouseEvent):void
		{

			var item:MovieClip	=	e.currentTarget as MovieClip;	
			if(item["data"] != null && getType(item["preFBID"]))
			{
				if(_oldMc != null)
				{
					_oldMc.gotoAndStop(1);
					_oldMc.enterBtn.visible		=	false;
					_oldMc.wipeBtn.visible		=	false;
				}
				item.gotoAndStop(2);
				showItemInfo(item["data"]);
				item.enterBtn.enabled		=	item.wipeBtn.enabled	=	true;
				if (getType(item["data"]["preFBID"])) 
				{
					if (getType(item["data"]["chapterEnterScene"])) 
					{
						item.enterBtn.visible		=	item.wipeBtn.visible	=	true;
						item.enterBtn.x				=	19;
					}
					else
					{
						item.enterBtn.visible		=	true;
						item.enterBtn.x				=	54;
					}
				}
				else
				{
					item.enterBtn.visible		=	true;
					item.enterBtn.enabled		=	false;
					item.enterBtn.x				=	46;
				}
				item.enterBtn.addEventListener(MouseEvent.CLICK, btnClickHandle);
				item.wipeBtn.addEventListener(MouseEvent.CLICK, btnClickHandle);
				_oldMc	=	item;
				_turnPagersViewGroup.chooseIndex	=	item["pageIndex"];
				checkShowEffect(item);
			}	
		}
		/**
		 * 进入副本
		 * @param	e
		 */
		private function btnClickHandle(e:MouseEvent):void 
		{
			var clickBtn:NxButton	=	e.target as NxButton
			var box:MovieClip	=	clickBtn.parent  as MovieClip;
			var sendData:Object	=	box["data"];
			
			if (sendData != null) 
			{
				var sceneID:int	=	sendData["chapterEnterScene"]
				intoSceneID	=	sceneID
				switch (clickBtn.name) 
				{
					case "enterBtn":
						SystemSender.getInstance().CustomMsg(CustomToServerFlag.CLIENT_CUSTOMMSG_FB_ENTER, sceneID);
						break;
					case "wipeBtn":
//						WipeOutLogic.getInstance().WipeTarget = intoSceneID;
						if(WipeOutUI.getInstance().created)
						{
							var parnte:DisplayObjectContainer=WipeOutUI.getInstance().parent;
							parnte.swapChildren(WipeOutUI.getInstance(),DuplicatesUI.getInstance());
						}
						SystemSender.getInstance().CustomMsg(CustomToServerFlag.CLIENT_CUSTOMMSG_FB_SWEEP_REQUEST, intoSceneID);
							
						break;
					default:
				}
			}
		}
		/**
		 * 
		 */
		private function YesFun(type:int, str:String, clickData:*):void
		{
			if(AlertUI.OK == type )
			{
				if(itemObj.hasOwnProperty("VIEWPORT_TOOL"))
				{
					SystemSender.getInstance().CustomMsg( CustomToServerFlag.CLIENT_CUSTOMMSG_USEITEM,itemObj["VIEWPORT_TOOL"],int(itemObj["PackIndex"]) );
				}else if(itemObj.hasOwnProperty("VIEWPORT_STORE"))
				{
					SystemSender.getInstance().CustomMsg( CustomToServerFlag.CLIENT_CUSTOMMSG_USEITEM,itemObj["VIEWPORT_STORE"], int(itemObj["DuIndex"]) );
				}
				
				
			}else if(AlertUI.NO == type)
			{
//				SystemSender.getInstance().CustomMsg(CustomToServerFlag.CLIENT_CUSTOMMSG_FB_SWEEP_REQUEST, intoSceneID);
			}
			
			if(WipeOutUI.getInstance().created)
			{
				var parnte:DisplayObjectContainer=WipeOutUI.getInstance().parent;
				parnte.swapChildren(WipeOutUI.getInstance(),DuplicatesUI.getInstance());
			}
			SystemSender.getInstance().CustomMsg(CustomToServerFlag.CLIENT_CUSTOMMSG_FB_SWEEP_REQUEST, intoSceneID);
		}
		/**
		 * 副本信息
		 * @param	e
		 */
		private function picClickHandle(e:MouseEvent):void 
		{
			var pic:NxClip	=	e.target as NxClip;
			var viewItem:MovieClip	=	pic.parent.parent as MovieClip
			if (viewItem != null) 
			{
				if (viewItem["data"] != null) 
				{
					showItemInfo(viewItem["data"]);
				}
			}
		}
		/**
		 * 状态是否通过次节
		 * @return
		 */
		private function getType(fbID:int):Boolean
		{
			var _isOK:Boolean	=	false;
			if (fbID == 0) 
			{
				return true;
			}
			if(completeFB.indexOf(fbID)!=-1)
			{
				_isOK	=	true;
				return _isOK;
			}
//			for (var i:int = 0; i < completeFB.length; i++) 
//			{
//				if (completeFB[i][0] == fbID)
//				{
//					
//					_isOK	=	true;
//					return _isOK;
//				}
//			}
			return _isOK;
		}
		/**
		 * 所对应的任务是否完成 
		 * @param taskID
		 * @return 
		 */		
		public function getTaskComplete(taskID:int):Boolean
		{
			var _isComplete:Boolean	=	false;
			var itemArray:Array		=	[];
			if(taskID == 0)
			{
				return true;
			}
			var arrayLong:int	=	completeTaskFB.length;
			for(var i:int = 0; i < arrayLong; i++)
			{
				itemArray	=	completeTaskFB[i];
				if(itemArray[0] == taskID)
				{
					_isComplete	=	true;
				}
			}
			return _isComplete;
		}
		private function getGread(fbID:int):int
		{
			var gread:int	=	0;
			var itemArray:Array	= [];
			var arrayLong:int	=	greadFB.length;
			for (var i:int = 0; i < arrayLong; i++) 
			{
				itemArray	=	greadFB[i];
				if (itemArray[0] == fbID)
				{
					gread	=	itemArray[1]
				}
			}
			return gread;
		}
		/**
		 * 获取完成表
		 */
		private function get completeFB():Array
		{
			var recA:Array;
			var returnArr:Array = [];
			if(_model.scene.CheckProperties("CompletedFB"))
			{
				recA = (_model.scene.GetPropertiesEx("CompletedFB") as Record).recArr;
			
				for(var i:int = 0;i<recA.length ;i++)
				{
					returnArr.push(recA[i][0]);		
				}
				return returnArr;
			}
			else
			{
				returnArr =  [];
				return returnArr
			}
			return returnArr;
		}
		/**
		 * 获取评分表
		 */
		private function get greadFB():Array
		{
			if(_model.scene.CheckProperties("FBGrade"))
			{
				return (_model.scene.GetPropertiesEx("FBGrade") as Record).recArr;
			}
			else
			{
				return []
			}
		}
		/**
		 * 获取任务完成表 
		 * @return 
		 * 
		 */		
		private function  get completeTaskFB():Array
		{
			if(_model.scene.CheckProperties("Task_Completed"))
			{
				return (_model.scene.GetPropertiesEx("Task_Completed") as Record).recArr;
			}
			else
			{
				return [];
			}
		}
		/**
		 * 显示当前的副本项目是否要有标识 
		 * @param val
		 * 
		 */		
		private function checkShowEffect(val:MovieClip):void
		{
			_myDisplay.intoEffect.stop();
			_myDisplay.intoEffect.visible	=	false;
			_myDisplay.collEffect.stop();
			_myDisplay.collEffect.visible	=	false;
			
			if(_FBSceneID != "")
			{
				if(_isCanInitFbIndex == (_turnPagersViewGroup.nowPage - 1) * _myDisplay.itemGroup.col + val["index"])
				{
					if(_FBSceneType == PK_FB)
					{
						_myDisplay.intoEffect.play();
						_myDisplay.intoEffect.visible	=	true;
						_myDisplay.intoEffect.x			=	_myDisplay.itemGroup.x + val.x + val.width /2;
					}
					else if(_FBSceneType == COLL_FB)
					{
						_myDisplay.collEffect.play();
						_myDisplay.collEffect.visible	=	true;
						_myDisplay.collEffect.x			=	_myDisplay.itemGroup.x + val.x + val.width /2;
					}
				}
			}
		}
		public function get isOpen():Boolean
		{
			return _isOpen;
		}
		/**
		 * 检查仓库背包中物品的数量 
		 * @param id 物品ConfigID
		 * @param type 返回类型参数
		 * @return   type= 1物品数量 /type= 2物品(返回等级最高的)
		 * 
		 */		
		/**物品是在背包还是在仓库还有位置；*/   
		private var itemObj:Object  ;
		public function searchItem(ConfigId:int,type:int):*
		{
			itemObj = {} ; 
			var packVo:View		=	ModelLocator.getInstance().scene.GetView(View.VIEWPORT_TOOL);
			//背包数量
			var itemArr:Array =[];  //存放该configid 所有物品数组
			var packCount:int=0;
			if(packVo !=null)
			{
				for (var property:String in packVo.Properties) 
				{
					if(int(property))
					{
						if(packVo.CheckProperties(property))
						{
							var item:ViewObject=packVo.GetPropertiesEx(property);
							if(item.GetPropertiesEx("ConfigID")==ConfigId)
							{
								itemObj["VIEWPORT_TOOL"] = View.VIEWPORT_TOOL
								itemObj["PackIndex"] =property; 
								
								if(item.CheckProperties("Amount"))
								{
									packCount+=item.GetPropertiesEx("Amount");
								}
								else
								{
									packCount++;
								}
								if(type == 2)
								{
									itemArr.push(item);
								}
							}
						}
						
					}
				}
			}
			
			var depotVo:View	=	ModelLocator.getInstance().scene.GetView(View.VIEWPORT_STORE);
			
			//仓库数量
			var depotCount:int=0;
			for(var property1:String in depotVo.Properties)
			{
				if(int(property1))
				{
					if(depotVo.CheckProperties(property1))
					{
						var item1:ViewObject=depotVo.GetPropertiesEx(property1);
						if(item1.GetPropertiesEx("ConfigID")==ConfigId)
						{
							//							if(item1.CheckProperties("EquipType")) //装备就不搜仓库
							//								break;
							itemObj["VIEWPORT_STORE"] = View.VIEWPORT_STORE
							itemObj["DuIndex"] =property1; 
							
							if(item1.CheckProperties("Amount"))
							{
								depotCount+=item1.GetPropertiesEx("Amount");
								
							}
							else
							{
								depotCount++;
							}
							if(type == 2)
							{
								itemArr.push(item1);
							}
						}
					}
				}
			}
			if(type==1)
			{
				return packCount+depotCount;	
			}
			
		}
		public function set isOpen(value:Boolean):void
		{
			_isOpen = value;
		}
		public function get _itemObj():Object
		{
			return itemObj ; 
		}
		
	}

}